package com.free.compilation.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.free.compilation.domain.ZoneCompilationStep;
import org.apache.ibatis.annotations.Select;

/**
 * 合集步骤Mapper接口
 *
 * @author free
 * @date 2023-07-25
 */
public interface ZoneCompilationStepMapper extends BaseMapper<ZoneCompilationStep> {
    @Select("" +

            " SELECT " +
            "  *  " +
            " FROM " +
            "  zone_compilation_step  " +
            " WHERE " +
            " compilation_id = #{compilationId} " +
            "AND deleted = 0" +
            "  and id not IN ( " +
            "  SELECT " +
            "   id  " +
            "  FROM " +
            "   zone_compilation_step  " +
            " WHERE " +
            " chapter_id IN ( SELECT id FROM zone_compilation_chapter WHERE compilation_id = #{compilationId} ))" +
            "")
    List<ZoneCompilationStep> notQuoteChapter(Long compilationId);

    @Select("")
    Integer selectMaxSort();
}
